package listener;

import com.ruoyi.app.config.context.UserInfoContextHolder;
import com.ruoyi.service.user.model.UserInfoModel;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener;

/**
 * <p>
 * 作用：构建必要数据
 * </p>
 *
 * @author Zane
 * @since 2025-10-18 11:52
 */
public class DataInitListener  implements TestExecutionListener {

  @Override
  public void beforeTestClass(TestContext testContext) throws Exception {
    UserInfoContextHolder.set(new UserInfoModel().setUserId(104L).setName("张宝宝"));
  }

  @Override
  public void beforeTestMethod(TestContext testContext) throws Exception {
    //补充方法级别
  }
}
